<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="./../template/main.xhtml">
        <ui:define name="content">
            <p:panel styleClass="FORM_HEADER_NEW">
                <h:outputText value="Estimation List" styleClass="FORM_HEADER_NEW"/>    
            </p:panel>
            <br></br>
            <h:form>
                <p:dataTable value="#{estimationController.estimationDTOList}" var="estimation"
                             paginator="true" paginatorAlwaysVisible="false" paginatorPosition="bottom"
                             rowStyleClass="SIMPLE_LINE">
                    <p:column>
                        <f:facet name="header">Id</f:facet>
                        <h:outputText value="#{estimation.id}" styleClass="COLUMN"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">Name</f:facet>
                        <h:outputText value="#{estimation.name}" styleClass="COLUMN"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">Client</f:facet>
                        <h:outputText value="#{estimation.clientName}" styleClass="COLUMN"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">Job Status</f:facet>
                        <h:outputText value="#{estimation.jobStatusName}" styleClass="COLUMN"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">Project</f:facet>
                        <h:outputText value="#{estimation.projectName}" styleClass="COLUMN"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">Estimation<br></br>Details</f:facet>
                        <h:outputText value="#{estimation.itemEstimationId}" styleClass="COLUMN"/>
                    </p:column>

                    <p:column>
                        <f:facet name="header">Action</f:facet>
                        <h:commandLink value="View" action="#{estimationController.view}">
                            <f:param name="estimationId" value="#{estimation.id}"/>
                        </h:commandLink>
                        <h:outputText value="&nbsp;&nbsp;"/>
                        <h:commandLink value="Edit" action="#{estimationController.edit}">
                            <f:param name="estimationId" value="#{estimation.id}"/>
                        </h:commandLink>
                        <h:outputText value="&nbsp;&nbsp;"/>
                        <h:commandLink value="Won" 
                                       action="#{estimationController.convertEstimationToProject(estimation)}"
                                       rendered="#{empty estimation.projectName}">
                            <f:param name="estimationId" value="#{estimation.id}"/>
                        </h:commandLink>
                    </p:column>
                </p:dataTable>

            </h:form>
        </ui:define>
    </ui:composition>
</html>